package com.example.front.controller;

import com.example.front.dto.BoxRequest;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class TestController {
    @Autowired
    ObjectMapper objectMapper;

    public void test (@RequestBody String raw) throws JsonProcessingException {

        //{"ID":"10376577833960419800","model":"SP-AD433A","dev_addr":6,"key_num":5,"key_sta":2}
            String str ="{\"ID\":\"10376577833960419800\",\"model\":\"SP-AD433A\",\"dev_addr\":6,\"key_num\":5,\"key_sta\":2}";

        System.out.println(raw);

        BoxRequest demoRequest = objectMapper.readValue(raw, BoxRequest.class);
//        demoRequest.setModel(demoRequest.getModel().toUpperCase());
        System.out.println(demoRequest.toString());
    }
}
